<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk">

<f:view>
<f:loadBundle var="text" basename="#{itemList.bundleName}"/>
    <head>
        <title>#{text['itemList.title']}</title>
        <meta name="heading" content="#{text['itemList.heading']}"/>
        <meta name="menu" content="itemMenu"/>
    </head>
<body id="itemList">
<h:form id="edititem">

<h:commandButton value="#{text['button.add']}" action="add" id="add" immediate="true" styleClass="button_small"/>
<h:commandButton value="#{text['button.done']}" action="mainMenu" id="cancel" immediate="true" styleClass="button_small" style="margin-left: 5px"/>

<!-- Error from this table is caused by http://issues.apache.org/jira/browse/TOMAHAWK-466 -->
<t:dataTable id="items" var="item" style="margin-top: 10px"
    value="#{itemList.items}" rows="25" sortColumn="#{itemList.sortColumn}"
    sortAscending="#{itemList.ascending}" styleClass="scrollerTable table"
    headerClass="standardTable_Header" rowClasses="standardTable_Row1,standardTable_Row2"
    columnClasses="standardTable_Column,standardTable_Column,standardTable_Column,standardTable_Column,standardTable_ColumnCentered">

    <t:column>
        <f:facet name="header">
            <t:commandSortHeader columnName="objectId" arrow="true">
                <h:outputText value="#{text['item.id']}" />
            </t:commandSortHeader>
        </f:facet>
        <h:commandLink action="#{itemForm.edit}" value="#{item.objectId}">
            <f:param name="objectId" value="#{item.objectId}"/>
            <f:param name="from" value="list"/>
        </h:commandLink>
    </t:column>

    <t:column>
        <f:facet name="header">
            <t:commandSortHeader columnName="itemName" arrow="true">
                <h:outputText value="#{text['item.name']}" />
            </t:commandSortHeader>
        </f:facet>
        <h:outputText value="#{item.name}" escape="true"/>
    </t:column>
    
    <t:column>
        <f:facet name="header">
            <t:commandSortHeader columnName="extId" arrow="true">
                <h:outputText value="#{text['item.extId']}" />
            </t:commandSortHeader>
        </f:facet>
        <h:outputText value="#{item.extId}" escape="true"/>
    </t:column>

    <t:column>
        <f:facet name="header">
            <t:commandSortHeader columnName="description" arrow="true">
                <h:outputText value="#{text['item.description']}" />
            </t:commandSortHeader>
        </f:facet>
        <h:outputText value="#{item.description}" escape="true"/>
    </t:column>

</t:dataTable>
<ui:include src="/common/tableFooter.xhtml">
    <ui:param name="tableName" value="items"/>
</ui:include>
<script type="text/javascript">
    highlightTableRows("edititem:items");
</script>


</h:form>
</body>
</f:view>
</html>